package com.miage.kangourou.client.calendar;

import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.Widget;

public class NewEventWidget extends GenericWidget {
	private Button addEvent = null;

	public NewEventWidget(KangourouPanel context) {
		super(context, "newevent");
	}

	public Widget createWidget() {

		
		addEvent = new Button("Nouvel \u00E9v\u00E8nement");
		 addEvent.setEnabled(false);
		 addEvent.setVisible(false);
		
		addEvent.addClickHandler(new ClickHandler() {
			public void onClick(ClickEvent event) {
				
				if(context.utilisateurEnCours.isAdmin()){
				PopupAddEvent popup = new PopupAddEvent();

				popup.show();
				}
			}
		});
		
		return addEvent;
	}

	public void configureWidget() {

       if(context.utilisateurEnCours.isAdmin())
       {
    	  
    	   addEvent.setVisible(true);
    	   addEvent.setEnabled(true);
       }
       else
       {
    	   addEvent.setVisible(false);
    	   addEvent.setEnabled(false);
       }
		
	}



}
